<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

$db = new DB('news');

$category_sql = 'select id,child_id,orders,title,top_id from categories where top_id=0 and is_del=1 order by orders desc,id desc';
$category_rs = $db->query($category_sql)->getAll();
foreach($category_rs as $child_key =>$child_row){
	if($child_row['child_id']){
		$child_sql = 'select id,orders,title,top_id from categories where id in('.$child_row["child_id"].')';
		$category_rs[$child_key]['child_list'] = $db->query($child_sql)->getAll();
	}
}

//包含模板
require template('admin/news/category/category_lists');